{% extends "blog/index.html" %}

{% block title %}
博客分类 {{ cate.name }} - 残阳似血的博客
{% endblock %}

{% block js %}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> 
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shCore.js"></script> 
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shAutoloader.js"></script>
<!--
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shBrushCpp.js"></script>
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shBrushCSharp.js"></script>
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shBrushCss.js"></script>
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shBrushJava.js"></script>
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shBrushJScript.js"></script>
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shBrushPlain.js"></script>
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shBrushPython.js"></script>
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shBrushSql.js"></script>
<script language="JavaScript" src="/static/blog/js/SyntaxHighlighter/shBrushXml.js"></script>
-->
<script language="JavaScript" src="/static/blog/js/jquery.pagination.js"></script> 

<script language="JavaScript"> 
	$(document).ready(function(){
		SyntaxHighlighter.autoloader(
		  'cpp c                  /static/blog/js/SyntaxHighlighter/shBrushCpp.js',
		  'c# c-sharp csharp      /static/blog/js/SyntaxHighlighter/shBrushCSharp.js',
		  'css                    /static/blog/js/SyntaxHighlighter/shBrushCss.js',
		  'java                   /static/blog/js/SyntaxHighlighter/shBrushJava.js',
		  'js jscript javascript  /static/blog/js/SyntaxHighlighter/shBrushJScript.js',
		  'text plain             /static/blog/js/SyntaxHighlighter/shBrushPlain.js',
		  'py python              /static/blog/js/SyntaxHighlighter/shBrushPython.js',
		  'sql                    /static/blog/js/SyntaxHighlighter/shBrushSql.js',
		  'xml xhtml xslt html    /static/blog/js/SyntaxHighlighter/shBrushXml.js',
		  'go                     /static/blog/js/SyntaxHighlighter/shBrushGo.js'
		);
		SyntaxHighlighter.all();
	});
	//SyntaxHighlighter.all();
	
	var enable_load = false;
	$(function(){
		$("div#footer-bottom p.bottom-right a:last").click(function(){
			targetOffset = $("body").offset().top;
			$('html,body').stop().animate({scrollTop: targetOffset}, 500);
			return false;
		});
		
		$("#Pagination").pagination("{{ n_articles }}",{
			callback:pageselectCallback,
			prev_text: '&laquo 上一页',
			next_text: '下一页 &raquo;',
			items_per_page: 10,
			num_display_entries:6,
			current_page: '{{ page }}',
			num_edge_entries: 2,
			link_to: '#main',
			prev_show_always:false,
			next_show_always:false
		});
	})
	
	function pageselectCallback(page_id, jq) { 
		//New add
		if(enable_load){
	        location.href = "http://qinxuye.me/category/{{ cate.slug }}/page/" + (Number(page_id)+1);
		}
		else{
			enable_load = true;
		}
	
		//initData(page_id); 
	} 
	
	function initData(pageIndex){
		if(enable_load){
			$.ajax({
				type: "GET",
			    url: "/category/{{ cate.slug }}/page/" + (Number(pageIndex)+1) + "?from=ajax",
			    success: function(msg){
					$("#main div.post:gt(0)").remove();
			        $(msg).insertAfter("#main div.post:eq(0)");
					SyntaxHighlighter.highlight();
			    }
			});
		}
		else{
			enable_load = true;
		}
		
		$('body').ajaxStart(function(){
			$(this).addClass('overlay')
		});
		$('body').ajaxComplete(function(){
			$(this).removeClass('overlay')
		});
	}
</script> 
{% endblock %}

{% block label %}
<div class="post">
	<p class="highlight">博客分类 &#8216;{{ cate.name }}&#8217;</p> 
</div>
{% endblock %}